package com.labofjet.blogv3.facade;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Component;

import com.labofjet.blogv3.model.Artical;
import com.labofjet.blogv3.model.Category;
import com.labofjet.blogv3.model.History;
import com.labofjet.blogv3.service.impl.ArticalService;
import com.labofjet.blogv3.service.impl.CategoryService;
import com.labofjet.blogv3.service.impl.HistoryService;

@Component
public class HomeFacade {
	@Autowired
	private CategoryService categoryService;
	
	@Autowired
	private ArticalService articalService;
	
	@Autowired
	private HistoryService historyService;
	
	public List<Category> findAllCategories(){
		return categoryService.findAll();
	}
	
	public Page<Artical> findAllTopArticals(){
		return articalService.findAllTopArticals();
	}
	
	public Page<Artical> findArticals(int currentPage){
		return articalService.findArticals(currentPage);
	}
	
	public List<History> findAllHistory(){
		return historyService.findAllHistory();
	}

	public Page<Artical> findCategoryArticals(String keyword, int currentPage) {
		return articalService.findCategoryArticals(keyword, currentPage);
	}
	
	public Artical findArtical(long id){
		return articalService.findArtical(id);
	}
}
